import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Loginview from '../views/LoginView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),

  routes: [
    // {
    //   path: '/',
    //   name: 'login',
    //   component: Loginview,
    // },
    {
      path: '/',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView,
      //生成子路由
      children: [
        {
          path: '/home/user',
          name: 'user',
          component: () => import('../views/UserView.vue'),
        },
        {
          path: '/home/traceability',
          name: 'traceability',
          component: () => import('../views/TraceabilityView.vue'),
        },
      ]
    }
  ],
})

export default router
